
import os, time

class PP:

    def __init__(self, path):
        self.path = path
    #创建文件夹
    def madir(self):
        folder = os.path.exists(self.path)
        if not folder:
            os.makedirs(self.path)
            print("创建文件夹成功")
        else:
            print("该文件夹已存在")

    def read(self, path):
        f = open(path)
        ll = f.read()
        return ll

    # 创建文件
    def touch(self, path):
        files = os.path.exists(path)
        if not files:
            file = open(path, 'w+')
            file.close()
            self.path = path
            return self.path
        else:
            print("该文件已存在")
            self.path = path
            return self.path

    #删除文件
    def delete(self, path):
        folder = os.path.exists(path)
        if folder:
            os.remove(path)

    def write(self, message):
        with open(self.path, 'a+', encoding='utf-8') as f:
            f.write(message+'\n')
        f.close()

    def get_path(self):
        return self.path





class Produce_path():

    def __init__(self):
        self.mkdirPah = '/home/tqw/SKLearn-Op/data/'
        self.filePath = ''

    def make_file_path(self, output):
        self.filePath = self.mkdirPah +output
        return self.filePath

    def get_mkdirPath(self):
        return self.mkdirPah

    def get_filePath(self):
        return self.filePath


